package com.andreide.dbf;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.FrameLayout;
import android.widget.TextView;

public class CosaFacciamoDescrizione extends Activity {

	private FrameLayout mFrameLayout;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.what_desc);

		int what_selected = getIntent().getIntExtra(CosaFacciamo.WHAT_SELECTED, 8);
		Log.d(DBFInformaticaActivity.DBF, "passata la selezione numero:" + CosaFacciamo.WHAT_SELECTED);

		switch(what_selected){
		case 1:

			TextView titoloHW = (TextView) findViewById(R.id.whatDescTitle);
			TextView descHwExt = (TextView) findViewById(R.id.whatDescExtended);
			titoloHW.setText(R.string.WhatTitleHw);
			descHwExt.setText(R.string.WhatDescExtHw);
			break;

		case 2:
			TextView titoloSW = (TextView) findViewById(R.id.whatDescTitle);
			TextView descSwExt = (TextView) findViewById(R.id.whatDescExtended);
			titoloSW.setText(R.string.WhatTitleSw);
			descSwExt.setText(R.string.WhatDescExtSw);
			break;

		case 3:
			TextView titoloGe = (TextView) findViewById(R.id.whatDescTitle);
			TextView descGeExt = (TextView) findViewById(R.id.whatDescExtended);
			titoloGe.setText(R.string.WhatTitleGe);
			descGeExt.setText(R.string.WhatDescExtGe);
			break;

		}
	}


	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);

		MenuInflater cosaDescMenuInflater = getMenuInflater();
		cosaDescMenuInflater.inflate(R.menu.change_background, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch(item.getItemId()){
		case R.id.menuBackNorm:
			mFrameLayout = (FrameLayout) findViewById(R.id.what_desc);
			mFrameLayout.setBackgroundResource(R.color.background);
			return true;
		case R.id.menuBackRed:
			mFrameLayout = (FrameLayout) findViewById(R.id.what_desc);
			mFrameLayout.setBackgroundColor(Color.MAGENTA);
			
		default:
			return super.onOptionsItemSelected(item);
		}}

}
